﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using blackhouse.Web.FasterFiles;
using blackhouse.JavaScript.JQuery;

namespace blackhouse.Web.Controls {
	public class PostbackActionControl : ActionControl {

		#region Constructors

		public PostbackActionControl(WebControl visitControl)
			: base(visitControl) {

		}

		#endregion

		#region Methods

		protected override void bind() {
			JQueryLibraries jql = new JQueryLibraries();
			jql.IncludeFileBasedOnJQuery("blackhouse.Web.Controls.ActionControl.postbackActionControl.js,blackhouse.Web.Controls");

			FasterFilesProvider ffp = new FasterFilesProvider();
			ffp.AddAfterScript("attachActionButton('" + this.getId() + "', " + string.Join(", ", this.parameters.Select(kvp => "'" + kvp.Key + "', '" + kvp.Value + "'").ToArray()) + ");");
		}

		#endregion

	}
}